# Maintainer: Sven-Hendrik Haase <svenstaro@gmail.com>
# Contributor: Lone_Wolf <lonewolf@xs4all.nl>
# Contributor: sausageandeggs <s_stoakley at hotmail.co.uk>

pkgname=singularity
pkgver=1.00
pkgrel=6
pkgdesc="Endgame: Singularity - simulation of true AI"
arch=('any')
url="http://emhsoft.com/singularity/index.html"
license=('GPL2' 'custom')
depends=('python' 'python-pygame' 'python-numpy')
makedepends=('python-setuptools')
source=("https://github.com/singularity/singularity/releases/download/v${pkgver}/singularity-${pkgver}.tar.gz"{,.asc}
        https://github.com/singularity/singularity-music/archive/025e2696638bcc3bf7690679c3a17c0b46823bbe.tar.gz
        "singularity.desktop")
validpgpkeys=('B3131A451DBFDF7CA05B4197054BBB9F7D806442')
sha512sums=('f3581048c5a535fdbd28d2af1ac596f5396fd712b716931f17de75f8b170f0e226deb2c113023357e21e7de1294e4a632515962df9ee43768baf0fb4bbaa08da'
            'SKIP'
            '9ec095e8882aa3981a4bbfe551f8d61c876fc6d0ee082f558f8e0f3015bfb65d23d76e5c3557a3e9ab41ddfe896eff618934c043ce8cee58709548f02fa81625'
            'd37e1a2a6d8e832a81114133df0ea5d5aeb531c81ba606b6bd49a6a38db1825660de9248593b9bfb40ddab4e1c9f794b6b5ed11ea273adb8bd9b4a363896b135')

prepare() {
  cd "$pkgname-$pkgver"

  mv "$srcdir"/singularity-music-* singularity/music
  sed -i "s|prune|recursive-include singularity/music *|g" MANIFEST.in
  sed -i "s|replaceme|python$(pacman -Q python | cut -d ' ' -f 2 | cut -d . -f 1,2)|g" "$srcdir"/singularity.desktop
}

build() {
  cd "$pkgname-$pkgver"

  python setup.py build
}

package() {
  cd "$pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
  mv run_singularity.sh "$pkgdir"/usr/bin/singularity

  install -Dm644 "$srcdir/singularity.desktop" "$pkgdir/usr/share/applications/singularity.desktop"
  install -Dm644 -t "$pkgdir"/usr/share/licenses/$pkgname LICENSE.cc0.txt LICENSE.CC-BY-SA-3.txt LICENSE.gpl.txt LICENSE.txt
}
# vim: sw=2:ts=2 et:
